#include <pthread.h>
#include <string.h>
#include <stdio.h>

static void* threadFunc(void* args)
{
    char* s = (char*)args;
    printf("%s", s);
    return (void*)strlen(s);
}

int main()
{
    pthread_t t1;
    const char* args = "Hello world\n";
    int s = pthread_create(&t1, NULL, threadFunc, (void*)args);
    if(s != 0)
        perror("pthread_create");
    printf("Message from main()\n");
    void* res;
    s = pthread_join(t1, &res);
    if(s != 0)
        perror("pthread_join");
    printf("Thread returned %ld\n", (long)res);
    return 0;
}
